import 'package:flutter/material.dart';
import 'package:sonora/shared/lib/constants/sj_colors.dart';
import 'package:sonora/utils/sj_text_style.dart';

class SjMedalObtainDialog extends StatelessWidget {
  final String assetPath;
  final String content;
  final VoidCallback onAgree;
  final VoidCallback onCancel;

  const SjMedalObtainDialog(
      {Key? key,
      required this.assetPath,
      required this.content,
      required this.onAgree,
      required this.onCancel})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Dialog(
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(1.0)),
        child: Container(
          padding: EdgeInsets.all(3),
          decoration: BoxDecoration(
            color: SjColors.blackColor,
            boxShadow: [
            BoxShadow(color: SjColors.themeColor, offset: Offset(2, 2))
          ]),
          child: Container(color: SjColors.textWhiteColor, child: Padding(
              padding: const EdgeInsets.all(14.0),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Image(
                    image: AssetImage(assetPath),
                    width: 80,
                    height: 80,
                  ),
                  SizedBox(
                    height: 12,
                  ),
                  Text(
                    content,
                    textAlign: TextAlign.center,
                    style: SjTextStyle.customFontBlack16,
                  ),
                  SizedBox(
                    height: 14,
                  ),
                  TextButton(
                    onPressed: () {
                      onAgree.call();
                      Navigator.of(context).pop();
                    },
                    style: TextButton.styleFrom(
                        backgroundColor: SjColors.blackColor, // 设置背景色
                        padding: EdgeInsets.symmetric(
                            horizontal: 20, vertical: 12), // 设置内边距
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(27), // 设置圆角
                        ),
                        minimumSize: Size(150, 40)),
                    child: Text(
                      "OK",
                      style: SjTextStyle.customFontTheme16, // 设置文本颜色
                    ),
                  ),],
              ),
            ),),
        ));
  }
}
